package cn.cagurzhan.controller;

import cn.cagurzhan.domain.R;
import cn.cagurzhan.domain.dto.CommandResultDto;
import cn.cagurzhan.domain.dto.LoginDto;
import cn.cagurzhan.domain.entity.EnvLog;
import cn.cagurzhan.mapper.EnvLogMapper;
import cn.cagurzhan.service.IoTService;
import cn.cagurzhan.service.LoginService;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.huaweicloud.sdk.iotda.v5.IoTDAClient;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * 登录控制器
 * @author AjaxZhan
 */
@RestController
@RequestMapping
@RequiredArgsConstructor
public class LoginController {

    private final LoginService loginService;

    /**
     * 登录
     * @return 用户token，携带用户名和用户ID
     */
    @PostMapping("/login")
    public R<Map<String,Object>> login(@RequestBody LoginDto loginDto){
        return loginService.login(loginDto);
    }


}
